package de.guidoludwig.jtm.client.artists;

import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JMenuBar;

import de.guidoludwig.af.AFProperties;
import de.guidoludwig.af.Application;


public class ArtistApplication implements Application {

	public static ArtistApplication INSTANCE = new ArtistApplication();
	private static final AFProperties PROPERTIES = new AFProperties(ArtistApplication.class);

	private Action addArtistAction;
	private Action deleteAction;

	private ArtistApplication() {
		initActions();
	}


	@Override
	public Icon getIcon() {
		return PROPERTIES.getIcon("application.icon");
	}

	@Override
	public String getShortName() {
		return PROPERTIES.getString("application.shortName");
	}

	@Override
	public String getTitle() {
		return PROPERTIES.getString("application.title");
	}

	private void initActions() {
		if (addArtistAction != null) {
			return;
		}
		addArtistAction = new AddArtistAction();
		deleteAction = new DeleteArtistAction();
	}

	@Override
	public boolean allowsExit() {
		return true;
	}

	@Override
	public JComponent getComponent() {
		ArtistHomeView view = new ArtistHomeView(ArtistHomeModel.getInstance());
		return view.buildPanel();
	}

	@Override
	public Action[] getToolbarActions() {
		return new Action[] {addArtistAction, deleteAction};
	}

	@Override
	public JMenuBar getMenuBar() {
		// FIXME Auto-generated method stub
		return null;
	}

	@Override
	public void activate() {
		// Nothing to activate
	}

}
